import baseInterfaces from '../api/baseInterfaces.js';

const burySpot = {};

burySpot.install = (Vue) => {
  Vue.directive('bury-spot', (el, binding) => {
    el.dataset.buryspot = binding.value;
    el.addEventListener(binding.arg || 'click', burySpotHandle);
  });
};

function burySpotHandle(e) {
  // 提交埋点数据
  baseInterfaces.recordUserBehavior2({ url: e.currentTarget.dataset.buryspot });
}

export default burySpot;
